package thread.simulation;

/**
 * Title：
 * Description：
 * Created by Myth on 4/24/2017.
 */
public class Test {
    public static void main(String[] args) {
        MyNumber myNumber = new MyNumber();
        //producer与consumer 中使用的myNumber是同一个句柄，指向堆区同一个位置，共享同一个区域
        Producer producer = new Producer(myNumber);
        Consumer consumer = new Consumer(myNumber);
        Thread threadProducer = new Thread(producer);
        Thread threadConsumer = new Thread(consumer);
        threadProducer.start();
        threadConsumer.start();
    }
}
